package reports;

import java.io.IOException;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import server.db.StmtHelper;
import server.json.FunctionalJSON;

import ajaxmethods.AjaxMethod;

public class Photos implements AjaxMethod {

	@Override
	public void perform(HttpServletRequest request, HttpServletResponse response) {
		response.setContentType("text/json");
		String listingid = request.getParameter("zillowID");
		try {
			FunctionalJSON.listToJSONArray.f(StmtHelper.db("select image_url from photos where zillowid = ").addVariable(listingid).collectStrings("image_url").unsafeGet()).write(response.getWriter());
		} catch (Exception e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		
		
	}

}
